package com.demo.web.modules.sca;

import com.demo.common.constant.api.ScaCatalogAPIConstant;
import com.demo.common.result.ResponseInfo;
import com.demo.common.result.ResultVo;
import com.demo.service.sca.ScaCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;

@RestController
@RequestMapping("/sca/catalog")
public class ScaCatalogController {
    @Autowired
    private ScaCatalogService cataService;

    @GetMapping("/test")
    public String test(){
        return "hello, you are in ScaCatalog test!";
    }

    //查询项目列表
    @RequestMapping(value = ScaCatalogAPIConstant.PROJECT_LIST_API, method = RequestMethod.POST)
    public ResultVo getProjectCatalogList() {
        return ResponseInfo.<Object>success(cataService.getProjectCatalogList());
    }

    //查询设备列表
    @RequestMapping(value = ScaCatalogAPIConstant.DEVICE_LIST_API, method = RequestMethod.POST)
    public ResultVo getDeviceCatalogList()  {
        return ResponseInfo.<Object>success(cataService.getDeviceCatalogList());
    }

    //查询变量列表
    @RequestMapping(value = ScaCatalogAPIConstant.VARIABLE_LIST_API, method = RequestMethod.POST)
    public ResultVo getVariableCatalogList()  {
        return ResponseInfo.<Object>success(cataService.getVariableCatalogList());
    }

    //查询页面列表
    @RequestMapping(value = ScaCatalogAPIConstant.PAGE_LIST_API, method = RequestMethod.POST)
    public ResultVo getPageCatalogList() {
        return ResponseInfo.<Object>success(cataService.getPageCatalogList());
    }

    //查询组件列表
    @RequestMapping(value = ScaCatalogAPIConstant.COMPONENT_LIST_API, method = RequestMethod.POST)
    public ResultVo getComponentCatalogList() {
        return ResponseInfo.<Object>success(cataService.getComponentCatalogList());
    }
}
